﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Activities;
using BBECServiceBusAdapter_CodeGenLib.AddForms.Constituent;

namespace BBECServiceBusAdapter.Helper_Activities.Inbound
{

    public sealed class CreateConstituentMinimal : CodeActivity
    {
        // Define an activity input argument of type string
        public InArgument<String> LookupId { get; set; }
        public InArgument<String> KeyName { get; set; }
        public InArgument<Guid> ConstituentId { get; set; }

        // If your activity returns a value, derive from CodeActivity<TResult>
        // and return the value from the Execute method.
        protected override void Execute(CodeActivityContext context)
        {
            // Obtain the runtime value of the Text input argument
            string theLookupId = context.GetValue(this.LookupId);
            string theKeyName = context.GetValue(this.KeyName);
            ConstituentMinimalAddDataFormCustomData frmData = new ConstituentMinimalAddDataFormCustomData();

            frmData.CUSTOMIDENTIFIER = theLookupId;
            frmData.KEYNAME = theKeyName;

            String sConstituentID;
            sConstituentID = frmData.Save(new Blackbaud.AppFx.WebAPI.AppFxWebServiceProvider(Blackbaud.AppFx.Workflow.CatalogActivities.WebApiUtility.GetAppFxWebApiProvider(context).ConnectionString));
            
            ConstituentId = new Guid(sConstituentID);



        }
    }
}
